package homework.apiday06.io2;

import java.io.*;
import java.util.Scanner;

public class PwDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        //具有自动行刷新功能
        FileOutputStream fos = new FileOutputStream("kk.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        BufferedWriter bw = new BufferedWriter(osw);

        PrintWriter pw = new PrintWriter(bw);

        Scanner scan = new Scanner(System.in);
        System.out.println("请输入内容,当输入exit时程序结束");
        while (true){
            String str = scan.nextLine();
            if ("homework_talkroom".equalsIgnoreCase(str)){
                break;
            }
            pw.println(str);
        }
        System.out.println("再见!");
        pw.close();


    }
}
